home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 10 / AACD 10.iso / AACD / Games / MAME / src / drivers / mrjong.c < prev    next >
C/C++ Source or Header  |  2000-05-11  |  7KB  |  237 lines

  1. /***************************************************************************
  2.  
  3. Mr.Jong
  4. (c)1983 Kiwako (This game is distributed by Sanritsu.)
  5.  
  6. Crazy Blocks
  7. (c)1983 Kiwako/ECI
  8.  
  9. Driver by Takahiro Nogi (nogi@kt.rim.or.jp) 2000/03/20 -
  10.  
  11. ***************************************************************************/
  12.  
  13. #include "driver.h"
  14. #include "vidhrdw/generic.h"
  15.  
  16.  
  17. void mrjong_vh_convert_color_prom(unsigned char *palette, unsigned short *colortable,const unsigned char *color_prom);
  18. void mrjong_vh_screenrefresh(struct osd_bitmap *bitmap, int full_refresh);
  19. WRITE_HANDLER( mrjong_flipscreen_w );
  20.  
  21.  
  22. static struct MemoryReadAddress readmem[] =
  23. {
  24.     { 0x0000, 0x7fff, MRA_ROM },
  25.     { 0x8000, 0x87ff, MRA_RAM },
  26.     { 0xa000, 0xa7ff, MRA_RAM },
  27.     { 0xe000, 0xe3ff, videoram_r },
  28.     { 0xe400, 0xe7ff, colorram_r },
  29.     { -1 }    /* end of table */
  30. };
  31.  
  32. static struct MemoryWriteAddress writemem[] =
  33. {
  34.     { 0x0000, 0x7fff, MWA_ROM },
  35.     { 0x8000, 0x87ff, MWA_RAM },
  36.     { 0xa000, 0xa7ff, MWA_RAM },
  37.     { 0xe000, 0xe3ff, videoram_w, &videoram, &videoram_size },
  38.     { 0xe400, 0xe7ff, colorram_w, &colorram },
  39.     { 0xe000, 0xe03f, MWA_RAM, &spriteram, &spriteram_size},    /* here to initialize the pointer */
  40.     { -1 }    /* end of table */
  41. };
  42.  
  43.  
  44. WRITE_HANDLER( io_0x00_w )
  45. {
  46.     mrjong_flipscreen_w(0, ((data & 0x04) > 2));
  47. }
  48.  
  49. READ_HANDLER( io_0x03_r )
  50. {
  51.     return 0x00;
  52. }
  53.  
  54. static struct IOReadPort readport[] =
  55. {
  56.     { 0x00, 0x00, input_port_0_r },        // Input 1
  57.     { 0x01, 0x01, input_port_1_r },        // Input 2
  58.     { 0x02, 0x02, input_port_2_r },        // DipSw 1
  59.     { 0x03, 0x03, io_0x03_r },        // Unknown
  60.     { -1 }    /* end of table */
  61. };
  62.  
  63. static struct IOWritePort writeport[] =
  64. {
  65.     { 0x00, 0x00, io_0x00_w },
  66.     { 0x01, 0x01, SN76496_0_w },
  67.     { 0x02, 0x02, SN76496_1_w },
  68.     { -1 }    /* end of table */
  69. };
  70.  
  71.  
  72. INPUT_PORTS_START( mrjong )
  73.     PORT_START    /* IN0 */
  74.     PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP    | IPF_4WAY | IPF_PLAYER2 )
  75.     PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT  | IPF_4WAY | IPF_PLAYER2 )
  76.     PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT | IPF_4WAY | IPF_PLAYER2 )
  77.     PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN  | IPF_4WAY | IPF_PLAYER2 )
  78.     PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON1 | IPF_PLAYER2 )
  79.     PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_START1 )
  80.     PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_START2 )
  81.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )        // ????
  82.  
  83.     PORT_START    /* IN1 */
  84.     PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP    | IPF_4WAY | IPF_PLAYER1 )
  85.     PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT  | IPF_4WAY | IPF_PLAYER1 )
  86.     PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT | IPF_4WAY | IPF_PLAYER1 )
  87.     PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN  | IPF_4WAY | IPF_PLAYER1 )
  88.     PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON1 | IPF_PLAYER1 )
  89.     PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_COIN1 )
  90.     PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_COIN2 )
  91.     PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNKNOWN )
  92.  
  93.     PORT_START    /* DSW1 */
  94.     PORT_DIPNAME( 0x01, 0x01, DEF_STR( Cabinet ) )
  95.     PORT_DIPSETTING(    0x01, DEF_STR( Upright ) )
  96.     PORT_DIPSETTING(    0x00, DEF_STR( Cocktail ) )
  97.     PORT_DIPNAME( 0x02, 0x00, DEF_STR( Flip_Screen ) )
  98.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  99.     PORT_DIPSETTING(    0x02, DEF_STR( On ) )
  100.     PORT_DIPNAME( 0x04, 0x00, DEF_STR( Bonus_Life ) )
  101.     PORT_DIPSETTING(    0x00, "30k")
  102.     PORT_DIPSETTING(    0x04, "50k")
  103.     PORT_DIPNAME( 0x08, 0x00, DEF_STR( Difficulty ) )
  104.     PORT_DIPSETTING(    0x00, "Normal")
  105.     PORT_DIPSETTING(    0x08, "Hard")
  106.     PORT_DIPNAME( 0x30, 0x00, DEF_STR( Lives ) )
  107.     PORT_DIPSETTING(    0x00, "3")
  108.     PORT_DIPSETTING(    0x10, "4")
  109.     PORT_DIPSETTING(    0x20, "5")
  110.     PORT_DIPSETTING(    0x30, "6")
  111.     PORT_DIPNAME( 0xc0, 0x00, DEF_STR( Coinage ) )
  112.     PORT_DIPSETTING(    0xc0, DEF_STR( 2C_1C ) )
  113.     PORT_DIPSETTING(    0x00, DEF_STR( 1C_1C ) )
  114.     PORT_DIPSETTING(    0x40, DEF_STR( 1C_2C ) )
  115.     PORT_DIPSETTING(    0x80, DEF_STR( 1C_3C ) )
  116. INPUT_PORTS_END
  117.  
  118.  
  119. static struct GfxLayout tilelayout =
  120. {
  121.     8, 8,                /* 8*8 characters */
  122.     512,                /* 512 characters */
  123.     2,                /* 2 bits per pixel */
  124.     { 0, 512*8*8 },            /* the two bitplanes are separated */
  125.     { 0, 1, 2, 3, 4, 5, 6, 7 },    /* pretty straightforward layout */
  126.     { 7*8, 6*8, 5*8, 4*8, 3*8, 2*8, 1*8, 0*8 },
  127.     8*8                /* every char takes 8 consecutive bytes */
  128. };
  129.  
  130. static struct GfxLayout spritelayout =
  131. {
  132.     16, 16,                /* 16*16 sprites */
  133.     128,                /* 128 sprites */
  134.     2,                /* 2 bits per pixel */
  135.     { 0, 128*16*16 },        /* the bitplanes are separated */
  136.     { 8*8+0, 8*8+1, 8*8+2, 8*8+3, 8*8+4, 8*8+5, 8*8+6, 8*8+7,    /* pretty straightforward layout */
  137.             0, 1, 2, 3, 4, 5, 6, 7 },
  138.     { 23*8, 22*8, 21*8, 20*8, 19*8, 18*8, 17*8, 16*8,
  139.             7*8, 6*8, 5*8, 4*8, 3*8, 2*8, 1*8, 0*8 },
  140.     32*8                /* every sprite takes 32 consecutive bytes */
  141. };
  142.  
  143. static struct GfxDecodeInfo gfxdecodeinfo[] =
  144. {
  145.     { REGION_GFX1, 0x0000, &tilelayout,      0, 32 },
  146.     { REGION_GFX1, 0x0000, &spritelayout,    0, 32 },
  147.     { -1 }        /* end of array */
  148. };
  149.  
  150.  
  151. static struct SN76496interface sn76496_interface =
  152. {
  153.     2,                /* 2 chips (SN76489) */
  154.     { 15468000/6, 15468000/6 },    /* 2.578 Mhz */
  155.     { 100, 100 }
  156. };
  157.  
  158.  
  159. static struct MachineDriver machine_driver_mrjong =
  160. {
  161.     {
  162.         {
  163.             CPU_Z80,
  164.             15468000/6,    /* 2.578 MHz?? */
  165.             readmem, writemem, readport, writeport,
  166.             nmi_interrupt, 1
  167.         }
  168.     },
  169.     60, DEFAULT_60HZ_VBLANK_DURATION,    /* frames per second, vblank duration */
  170.     1,                    /* single CPU, no need for interleaving */
  171.     0,
  172.  
  173.     /* video hardware */
  174.     32*8, 32*8, { 0*8, 30*8-1, 2*8, 30*8-1 },
  175.     gfxdecodeinfo,
  176.     16, 4*32,
  177.     mrjong_vh_convert_color_prom,
  178.  
  179.     VIDEO_TYPE_RASTER | VIDEO_SUPPORTS_DIRTY,
  180.     0,
  181.     generic_vh_start,
  182.     generic_vh_stop,
  183.     mrjong_vh_screenrefresh,
  184.  
  185.     /* sound hardware */
  186.     0, 0, 0, 0,
  187.     {
  188.         {
  189.             SOUND_SN76496,            /* SN76489 x2 */
  190.             &sn76496_interface
  191.         }
  192.     }
  193. };
  194.  
  195.  
  196. /***************************************************************************
  197.  
  198.   Game driver(s)
  199.  
  200. ***************************************************************************/
  201.  
  202. ROM_START( mrjong )
  203.     ROM_REGION( 0x10000, REGION_CPU1 )    /* code */
  204.     ROM_LOAD( "mj00", 0x0000, 0x2000, 0xd211aed3 )
  205.     ROM_LOAD( "mj01", 0x2000, 0x2000, 0x49a9ca7e )
  206.     ROM_LOAD( "mj02", 0x4000, 0x2000, 0x4b50ae6a )
  207.     ROM_LOAD( "mj03", 0x6000, 0x2000, 0x2c375a17 )
  208.  
  209.     ROM_REGION( 0x2000, REGION_GFX1 )    /* gfx */
  210.     ROM_LOAD( "mj21", 0x0000, 0x1000, 0x1ea99dab )
  211.     ROM_LOAD( "mj20", 0x1000, 0x1000, 0x7eb1d381 )
  212.  
  213.     ROM_REGION( 0x0120, REGION_PROMS )    /* color */
  214.     ROM_LOAD( "mj61", 0x0000, 0x0020, 0xa85e9b27 )
  215.     ROM_LOAD( "mj60", 0x0020, 0x0100, 0xdd2b304f )
  216. ROM_END
  217.  
  218. ROM_START( crazyblk )
  219.     ROM_REGION( 0x10000, REGION_CPU1 )    /* code */
  220.     ROM_LOAD( "c1.a6", 0x0000, 0x2000, 0xe2a211a2 )
  221.     ROM_LOAD( "c2.a7", 0x2000, 0x2000, 0x75070978 )
  222.     ROM_LOAD( "c3.a7", 0x4000, 0x2000, 0x696ca502 )
  223.     ROM_LOAD( "c4.a8", 0x6000, 0x2000, 0xc7f5a247 )
  224.  
  225.     ROM_REGION( 0x2000, REGION_GFX1 )    /* gfx */
  226.     ROM_LOAD( "c6.h5", 0x0000, 0x1000, 0x2b2af794 )
  227.     ROM_LOAD( "c5.h4", 0x1000, 0x1000, 0x98d13915 )
  228.  
  229.     ROM_REGION( 0x0120, REGION_PROMS )    /* color */
  230.     ROM_LOAD( "clr.j7", 0x0000, 0x0020, 0xee1cf1d5 )
  231.     ROM_LOAD( "clr.g5", 0x0020, 0x0100, 0xbcb1e2e3 )
  232. ROM_END
  233.  
  234.  
  235. GAME( 1983, mrjong,   0,      mrjong, mrjong, 0, ROT90, "Kiwako", "Mr. Jong (Japan)" )
  236. GAME( 1983, crazyblk, mrjong, mrjong, mrjong, 0, ROT90, "Kiwako (ECI license)", "Crazy Blocks" )
  237.